package com.swyd.controller;

import com.swyd.pojo.DiagProc;
import com.swyd.service.DiagProcService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class TestController{
    @Autowired
    DiagProcService diagProcService;

    @RequestMapping("/selectProc")
    @ResponseBody
    public String selectProc(String procId){
        if(procId == null){
            return "请输入诊断过程id";
        }
        DiagProc diagProcs = diagProcService.selectDiagProc(procId);
        return "诊断过程："+procId+"<br/>"+ diagProcs.toString();
    }

    @RequestMapping("/selectAllProc")
    @ResponseBody
    public String selectAllProc(){
        List<DiagProc> diagProcs = diagProcService.selectAllDiagProc();
        String info = "";
        for(DiagProc diagProc : diagProcs){
            info += (diagProc.toString() + "<br/><br/>");
        }
        return info;
    }

}
